#include"myname_pipe.hpp"


int main(){
    int fp = open(PATH_NAME,O_WRONLY);
    if(fp < 0) exit(1);

    //开始从键盘输入
    char buffer[1024];
    while(true){
        cout<<"请输入";
        fgets(buffer,sizeof(buffer),stdin);
        buffer[strlen(buffer)-1] = 0;//去换行
        int n = write(fp,buffer,strlen(buffer));
        assert(n == strlen(buffer));
        (void)n;
    }




    close(fp);

    sleep(10);
    removefifo(PATH_NAME);
    return 0;
}